package com.sdutcm.health_bigdata_demo.service;

import com.sdutcm.health_bigdata_demo.bean.User;
import com.sdutcm.health_bigdata_demo.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * Created with IntelliJ IDEA.
 *
 * @author 小浩
 * @date 2018-09-23 16:26
 * @package com.sdutcm.health_bigdata_demo.service
 * @description
 */
@Service
@Transactional
public class UserService {
    @Autowired
    UserDao userDao;
    //登录
    public boolean login(User user){
        return user.getPassword().equals(userDao.findUserByUsername(user.getUsername()).getPassword())?
                true:false;
    }

    //注册
    public boolean register(User user){
        return userDao.save(user)!=null?true:false;
    }
}
